<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>发布摆设</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="../js/ajaxupload.js"></script>

<script type="text/javascript">

$(document).ready(function(){

	m2('m1_007','m1_007_04');
	
	new AjaxUpload("#uploadFile", {
		action : "${ctx }/fileUpload!uploadBackgroundImage.do",
		autoSubmit : true,
		name : "myFile",
		onSubmit : function(file, extension) {
			if (extension && /^(jpg|png|jpeg|gif)$/i.test(extension)) {
			} else {
				alert("你所选择的文件不受系统支持");
				return false;
			}
		},
		onComplete : function(file, response) {
			var img = document.createElement("img");
    	    img.style.width =  "542px";
    		img.style.height = "251px";
    		$("#picImage").val(response);
    		img.src = '${img_server}/UploadImages/'+response+'?tempid='+new Date().getTime();
    		switch_image(img);
		}
	});
});

function clearAllNode(parentNode){
    while (parentNode.firstChild) {
      var oldNode = parentNode.removeChild(parentNode.firstChild);
       oldNode = null;
     }
}
function switch_image(img)
{
	clearAllNode(document.getElementById("photoTd"));
	document.getElementById("photoTd").appendChild(img);
}

	function checkForm(){

		var picImage = $("#picImage").val();
		if (picImage == "") {
			alert("请上传摆设背景图片。");
			return false;
		}

		var title = $.trim($("#title").val());
		if (title == "") {
			$("#title").focus();
			alert("请填写摆设图名称。");
			return false;
		}
		
		$("#backgroundImageForm").submit();
	}

</script>
</head>
<body>


<!-- 页面头部  -->
<jsp:include page="/commons/head_member.jsp"></jsp:include>

<form action="${ctx }/backimage/backImageAction!save.do" method="post" id="backgroundImageForm" name="backgroundImageForm" enctype="multipart/form-data">
<table width="960" border="0" cellspacing="0" cellpadding="0" align="center" class="tbl_add_border">
          <tr>
            <td colspan="100%" class="bt14A" align="center">发布摆设图</td>
          </tr>
          <tr><td class="bt14A">
          		<span class="style15" style="padding-left: 10px;">*</span>长方形(横)：
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_horizontal" id="size_one_horizontal" value="1"/>1档20-40
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_horizontal" id="size_two_horizontal" value="2"/>2档40-80
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_horizontal" id="size_three_horizontal" value="3"/>3档80-120
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_horizontal" id="size_four_horizontal" value="4"/>4档120-150
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_horizontal" id="size_five_horizontal" value="5"/>5档150-180
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_horizontal" id="size_six_horizontal" value="6"/>6档180-220
	          	</td>
          </tr>
          <tr><td class="bt14A">
          		<span class="style15" style="padding-left: 10px;">*</span>长方形(竖)：
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_one_vertical" value="1"/>1档30-50
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_two_vertical" value="2"/>2档50-70
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_three_vertical" value="3"/>3档70-90
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_four_vertical" value="4"/>4档90-110
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_five_vertical" value="5"/>5档110-130
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_six_vertical" value="6"/>6档130-160
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;" type="radio" name="backgroundImage.size_vertical" id="size_seven_vertical" value="7"/>7档160-230
	          	</td>
          </tr>
          <tr><td class="bt14A">
          		<span class="style15" style="padding-left: 10px;">*</span>正方形：
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_one_square" value="1"/>1档30-50
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_two_square" value="2"/>2档50-70
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_three_square" value="3"/>3档70-90
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_four_square" value="4"/>4档90-110
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_five_square" value="5"/>5档110-130
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_six_square" value="6"/>6档130-160
	          		<input onclick="return false;" onmouseup="this.checked=!this.checked;"  type="radio" name="backgroundImage.size_square" id="size_seven_square" value="7"/>7档160-230
	          	</td>
          </tr>
          <tr>
	            <td valign="top" class="bt14A">
	             	<span class="style15" style="padding-left: 10px;">*</span>上传摆设图：&nbsp;&nbsp;&nbsp;<span id="uploadFile" style="color: #0000FF">上传</span>
				  	<span class="style15" style="padding-left: 50px;">*</span>摆设图名称：<input name="backgroundImage.title" value="${backgroundImage.title }" type="text" id="title" size="25" maxlength="40">
	            </td>
          </tr>
          <tr>
          	 <td valign="top" class="bt14A">
          		 <span class="style15" style="padding-left: 10px;">*</span> 定义摆设位置：
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_left_up" value="1" type="radio"/>左上角&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_middle_up" value="2" type="radio"/>中上角&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_right_up" value="3" type="radio"/>右上角&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_left" value="4" type="radio"/>左&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_middle" value="5" type="radio"/>中&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_right" value="6" type="radio"/>右&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_left_down" value="7" type="radio"/>左下角&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_middle_down" value="8" type="radio"/>中下角&nbsp;
	          		 <input onclick="return false;" onmouseup="this.checked=!this.checked;" name="backgroundImage.position" id="position_right_down" value="9" type="radio"/>右下角&nbsp;
          	 </td>
          </tr>
          <tr>
	          <td colspan="100%" style="padding-left: 120px;">
		          	<!-- 隐藏域 begin -->
	            	 	<input type="hidden" name="picImage" id="picImage"/>
	            	<!-- 隐藏域 end -->
		            <img src="../images/an24.gif" width="114" height="31"  style="cursor: pointer ;border: 0"  onclick="checkForm()">
	          </td>
         </tr>
         <tr><td colspan="100%" style="font-family: 宋体;font-size: 12px" align="center">预览效果</td></tr>
         <tr>
         	<td colspan="100%" align="center">
	         	<div align="center" style="width:910px;border: solid 1px red;margin: 10px 0px 20px 0px;" id="photoTd">
	            	 <img src="../images/bj1.gif" width="542" height="251" id="ImageFile">
	            </div>
            </td>
         </tr>
</table>
</form>

<jsp:include page="/commons/foot_member.jsp"></jsp:include>

</body>
</html>